<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: Serial</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>Serial<br>
<small>
[<a class="el" href="group___controller.html">Controller</a>]</small>
</h1>Serial provides a way to send and receive data via the serial port.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g9193106181ca33626bd405a1f0434ee6">Serial_SetActive</a> (int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the active state of the Serial subsystem.  <a href="#g9193106181ca33626bd405a1f0434ee6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#gcce26617c8506ce4194adefd107f93a2">Serial_GetActive</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the active state of the Serial subsystem.  <a href="#gcce26617c8506ce4194adefd107f93a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#ga84bc3522badbcf45ad97e7a0320c54e">Serial_Write</a> (uchar *buffer, int count, int timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write a block of data to the Serial port.  <a href="#ga84bc3522badbcf45ad97e7a0320c54e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g38bf8f1f9d2f3eca49c449a1c1a4a350">Serial_Read</a> (uchar *buffer, int size, int timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read data from the Serial port.  <a href="#g38bf8f1f9d2f3eca49c449a1c1a4a350"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g8b7ec06170daf2e6d0b792fc47c1813f">Serial_GetReadable</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of bytes in the queue waiting to be read.  <a href="#g8b7ec06170daf2e6d0b792fc47c1813f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g656fe7020d5e9d1218ceb6d805c1a0ea">Serial_SetChar</a> (int character)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sends a character (in the range of 0 to 255) to the write queue.  <a href="#g656fe7020d5e9d1218ceb6d805c1a0ea"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#geaaa9b5540b566d9a34821a8b5039704">Serial_SetBaud</a> (int baud)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the serial baud rate.  <a href="#geaaa9b5540b566d9a34821a8b5039704"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g68d8aaf6db20f5d40c972816009df362">Serial_SetBits</a> (int bits)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the number of bits per character.  <a href="#g68d8aaf6db20f5d40c972816009df362"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#gbee8a4ec92c806213b16111c34888d55">Serial_SetParity</a> (int parity)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the parity.  <a href="#gbee8a4ec92c806213b16111c34888d55"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g8e7837524e2ce8996a228a550bba653e">Serial_SetStopBits</a> (int stopBits)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the stop bits per character.  <a href="#g8e7837524e2ce8996a228a550bba653e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g4a91a45c86376600e5d0bdcd43a67557">Serial_SetHardwareHandshake</a> (int hardwareHandshake)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets whether hardware handshaking is being used.  <a href="#g4a91a45c86376600e5d0bdcd43a67557"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g476bb22eb20b7b24c418182077c103bd">Serial_GetChar</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns a single character from the receive queue if available.  <a href="#g476bb22eb20b7b24c418182077c103bd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g6bc17fd08864dc68388da92e25a6d644">Serial_GetBaud</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the current baud rate.  <a href="#g6bc17fd08864dc68388da92e25a6d644"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g5509b2efd0f29408e77f22ae56c25947">Serial_GetBits</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of bits for each character.  <a href="#g5509b2efd0f29408e77f22ae56c25947"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#gb3fe0242e8d76457aec54976e2631b8a">Serial_GetParity</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the current parity.  <a href="#gb3fe0242e8d76457aec54976e2631b8a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#gae0e5f633a9a4845ca92cc09db683c13">Serial_GetStopBits</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of stop bits.  <a href="#gae0e5f633a9a4845ca92cc09db683c13"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__serial.html#g4fefdaf9c2c9573e475157c00c81537a">Serial_GetHardwareHandshake</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether hardware handshaking is being employed or not.  <a href="#g4fefdaf9c2c9573e475157c00c81537a"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Serial provides a way to send and receive data via the serial port. 
<p>
The subsystem is supplied with small input and output buffers (of 100 characters each) and at present the implementation is interrupt per character so it's not particularly fast.<p>
Permits all of the common serial characteristics to be set including:<ul>
<li>baud - the speed of the connection (110 - &gt; 2M) in baud or raw bits per second. 9600 baud is the default setting.</li><li>bits - the size of each character (5 - 8). 8 bits is the default setting.</li><li>stopBits - the number of stop bits transmitted (1 or 2) 1 stop bit is the default setting.</li><li>parity - the parity policy (-1 is odd, 0 is none and 1 is even). Even is the default setting.</li><li>hardwareHandshake - whether hardware handshaking is used or not. HardwareHandshaking is off by default.</li></ul>
<p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>Need to complete support for the Hardware Handshaking </dd></dl>
<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>Convert to DMA interface for higher performance.</dd></dl>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gcce26617c8506ce4194adefd107f93a2"></a><!-- doxytag: member="serial.c::Serial_GetActive" ref="gcce26617c8506ce4194adefd107f93a2" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetActive           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the active state of the Serial subsystem. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>State - 1/non-zero (on) or 0 (off). </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00100">100</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g6bc17fd08864dc68388da92e25a6d644"></a><!-- doxytag: member="serial.c::Serial_GetBaud" ref="g6bc17fd08864dc68388da92e25a6d644" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetBaud           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the current baud rate. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>baud </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00331">331</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g5509b2efd0f29408e77f22ae56c25947"></a><!-- doxytag: member="serial.c::Serial_GetBits" ref="g5509b2efd0f29408e77f22ae56c25947" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetBits           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of bits for each character. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>bits </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00344">344</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g476bb22eb20b7b24c418182077c103bd"></a><!-- doxytag: member="serial.c::Serial_GetChar" ref="g476bb22eb20b7b24c418182077c103bd" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetChar           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns a single character from the receive queue if available. 
<p>
This character is returned unsigned - i.e. having a value of 0 - 255. The return value is -1 if there is no character waiting. <dl class="return" compact><dt><b>Returns:</b></dt><dd>character from the queue or -1 if there is no character. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00306">306</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g4fefdaf9c2c9573e475157c00c81537a"></a><!-- doxytag: member="serial.c::Serial_GetHardwareHandshake" ref="g4fefdaf9c2c9573e475157c00c81537a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetHardwareHandshake           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns whether hardware handshaking is being employed or not. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>hardwareHandshake </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00383">383</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gb3fe0242e8d76457aec54976e2631b8a"></a><!-- doxytag: member="serial.c::Serial_GetParity" ref="gb3fe0242e8d76457aec54976e2631b8a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetParity           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the current parity. 
<p>
-1 means odd, 0 means none, 1 means even <dl class="return" compact><dt><b>Returns:</b></dt><dd>parity </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00357">357</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g8b7ec06170daf2e6d0b792fc47c1813f"></a><!-- doxytag: member="serial.c::Serial_GetReadable" ref="g8b7ec06170daf2e6d0b792fc47c1813f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetReadable           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of bytes in the queue waiting to be read. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>bytes in the receive queue. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00175">175</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gae0e5f633a9a4845ca92cc09db683c13"></a><!-- doxytag: member="serial.c::Serial_GetStopBits" ref="gae0e5f633a9a4845ca92cc09db683c13" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_GetStopBits           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the number of stop bits. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>stopBits </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00370">370</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g38bf8f1f9d2f3eca49c449a1c1a4a350"></a><!-- doxytag: member="serial.c::Serial_Read" ref="g38bf8f1f9d2f3eca49c449a1c1a4a350" args="(uchar *buffer, int size, int timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_Read           </td>
          <td>(</td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read data from the Serial port. 
<p>
Will block for the time specified (in ms) if there are insufficient characters. Blocking can be avoided if <a class="el" href="group__serial.html#g8b7ec06170daf2e6d0b792fc47c1813f" title="Returns the number of bytes in the queue waiting to be read.">Serial_GetReadable( )</a> is used to determine how many characters are available to read prior to calling this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to read into. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>size</em>&nbsp;</td><td>An integer specifying the maximum number of bytes to read. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>Time in milliseconds to block waiting for the specified number of bytes. 0 means don't wait. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>number of bytes read (&gt;=0) or error &lt;0 . </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00149">149</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g9193106181ca33626bd405a1f0434ee6"></a><!-- doxytag: member="serial.c::Serial_SetActive" ref="g9193106181ca33626bd405a1f0434ee6" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the active state of the Serial subsystem. 
<p>
This is automatically set to true by any call to Serial_Write or Serial_Read. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>An integer specifying the active state - 1 (on) or 0 (off). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>CONTROLLER_OK (=0) on success. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00074">74</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="geaaa9b5540b566d9a34821a8b5039704"></a><!-- doxytag: member="serial.c::Serial_SetBaud" ref="geaaa9b5540b566d9a34821a8b5039704" args="(int baud)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetBaud           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>baud</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the serial baud rate. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>baud</em>&nbsp;</td><td>The desired baud rate. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00210">210</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g68d8aaf6db20f5d40c972816009df362"></a><!-- doxytag: member="serial.c::Serial_SetBits" ref="g68d8aaf6db20f5d40c972816009df362" args="(int bits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>bits</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the number of bits per character. 
<p>
5 - 8 are legal values. 8 is the default. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bits</em>&nbsp;</td><td>bits per character </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00227">227</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g656fe7020d5e9d1218ceb6d805c1a0ea"></a><!-- doxytag: member="serial.c::Serial_SetChar" ref="g656fe7020d5e9d1218ceb6d805c1a0ea" args="(int character)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetChar           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>character</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sends a character (in the range of 0 to 255) to the write queue. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>character</em>&nbsp;</td><td>The character to be sent. Must be 0 &lt;= c &lt; 256. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00185">185</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g4a91a45c86376600e5d0bdcd43a67557"></a><!-- doxytag: member="serial.c::Serial_SetHardwareHandshake" ref="g4a91a45c86376600e5d0bdcd43a67557" args="(int hardwareHandshake)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetHardwareHandshake           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>hardwareHandshake</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets whether hardware handshaking is being used. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>hardwareHandshake</em>&nbsp;</td><td>sets hardware handshaking on (1) or off (0) </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00289">289</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gbee8a4ec92c806213b16111c34888d55"></a><!-- doxytag: member="serial.c::Serial_SetParity" ref="gbee8a4ec92c806213b16111c34888d55" args="(int parity)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetParity           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>parity</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the parity. 
<p>
-1 is odd, 0 is none, 1 is even. The default is none - 0. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>parity</em>&nbsp;</td><td>-1, 0 or 1. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00248">248</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g8e7837524e2ce8996a228a550bba653e"></a><!-- doxytag: member="serial.c::Serial_SetStopBits" ref="g8e7837524e2ce8996a228a550bba653e" args="(int stopBits)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_SetStopBits           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>stopBits</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the stop bits per character. 
<p>
1 or 2 are legal values. 1 is the default. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stopBits</em>&nbsp;</td><td>stop bits per character </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00268">268</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ga84bc3522badbcf45ad97e7a0320c54e"></a><!-- doxytag: member="serial.c::Serial_Write" ref="ga84bc3522badbcf45ad97e7a0320c54e" args="(uchar *buffer, int count, int timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Serial_Write           </td>
          <td>(</td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Write a block of data to the Serial port. 
<p>
Will block for the time specified (in ms) if the queue fills up. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to write from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>An integer specifying the number of bytes to write. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>Time in milliseconds to block waiting for the queue to free up. 0 means don't wait. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="serial_8c-source.html#l00113">113</a> of file <a class="el" href="serial_8c-source.html">serial.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
